import { request } from "./helpers";

export async function get() {
  const url = "/account/user/get";
  return request<{
    id: string;
    hashId: string;
    name: string;
    nick: string;
    email: string;
    validEnd: number;
  }>(url);
}

export async function put(params: { nick?: string; email?: string }) {
  return request("/account/user/put", params);
}

export async function login(params: { name: string; password: string }) {
  return request("/account/user/login", params);
}

export async function logout() {
  return request("/account/user/logout");
}

export async function updatePassword(params: {
  newPassword: string;
  oldPassword: string;
}) {
  return request("/account/user/password/put", params);
}
